// 使用JQUERY类
(function($){
	$.Categories = function(arg){
		var screenX, screenH, documentH;
		var opt = {
			callback: function(val, text){}
		};
		this.showextend = function(randfrm, arg){
			option = $.extend(opt, arg);		//合并数组对象
			this.showType(randfrm);
		}
		var othis = this;
		var isIE6 = !!window.ActiveXObject && !window.XMLHttpRequest;

		//------------------------岗位类别--------------------------------------------------------------------------------------
		this.showType = function(randfrm){
			if($(option.objId).html() == undefined || $(option.objId).html() == 'null'){
				othis.keep_con(randfrm);		//遮掩弹出层  2代表岗位在外面不能删除
			}else{
				othis.nextshow();
			}
			othis.keep_sceen();						//显示遮掩层
			othis.layer();							//显示弹出层函数
		}


		//遮掩层显示
		this.keep_con = function(randfrm){
			var str = '';
			str += '<div class="layer posCategories" id="jobFun' + randfrm + '">';
			str += '<div class="winTitle poswin"> <span class="one">Job category</span>';
			//str+='<span class="two"><img  src="'+closeImg+'" ></span> </div>';
			str += '<span class="two"><span class="close">×</span></span> </div>';
			str += '<div class="first">';
			str += '<div class="one"><div class="morepos">You havent choose jobs, choose jobs cannot release position.</div>';
			str += '<span class="btnok" style="margin-left:20px;"><a href="javascript:void(0);">confirm</a></span></div>';
			str += '<div class="two"><div class="cselect">The selected position：</div>';
			str += '<div class="poscate" id="funCate' + randfrm + '"></div><div class="btnok"><a href="javascript:void(0);" >confirm</a></div></div>';

			str += '<div class="three">';
			str += '<form onsubmit="return false" name="myform" id="myform" method="post">';
			str += '<span><input name="keyword" id="keyword" class="inptext" value="" type="text" placeholder="Please enter the keywords"/></span>';
			str += '<span class="search"><input id="sub" value="search" class="inpsub" type="submit" /></span>';
			str += '</form>';
			str += '</div>';
			str += '</div>';
			//循环类型
			str += '<div class="cateType"></div>';
			str += '</div>';
			$("body").append(str);//追加到页面

			//获取一二级职位
			$.ajax({
				type: "GET",
				url: "/common/en/positionalltwo/",
				dataType: "json",
				success: function(data){
					var str = '';
					//循环一级职位
					$.each(data, function(key, vv){
						str += '<dl>';
						str += '<dt><span>' + vv.value + '</span></dt>';
						str += '<dd><ul>';
						//循环二级职位
						$.each(vv.secondPosition, function(k, v){
							str += '<li class="posLi"><div class="divClass">';
							str += '<span class="divspan" kpos="' + v.text + '">' + mSubstr(v.value, 18) + '</span>';
							str += '</div></li>';
						});
						str += '</ul></dd>';
						str += '</dl>';
					});
					$(option.objId).find('.cateType').append(str);//追加到页面
					//设置高度
					othis.setHeight();
					othis.nextshow(randfrm);					//弹出当前选择的类型
					//鼠标点击事件
					$(option.objId).find('li div').click(function(){
						if($(this).parent('li').find('.pname').html() == undefined || $(this).parent('li').find('.pname').html() == 'null'){
							var index = $(this).parent('li').index();
							var pid = $(this).find('span').attr('kpos');
							keep_inputCon($(this).find('span'), index, randfrm);
						}else{
							$(this).parent('li').find('.divClass').addClass('addAttr');
							$(this).parent('li').find('.pname').show();

							//点击加载弹出层定位
							var cTop = $(option.objId).find('.cateType').offset().top;		//当前框到顶部的值
							var cHeight = $(option.objId).find('.cateType').height();		//当前高度
							var liTop = $(this).parents('li').offset().top;
							var pHeight = $(this).parents('li').find('.pname').height();
							var liHeight = $(this).parents('li').height();
							if(cHeight - (liTop - cTop + pHeight) - 20 > 0){
								$(this).parents('li').find('.divClass').css({
									"left": '-1px',
									"top": "-1px",
									"border-top": "1px solid #ccc",
									"border-bottom": "none"
								});
								$(this).parents('li').find('.pname').css({"left": '-1px', "top": liHeight - 2 + "px"});

							}else{
								$(this).parents('li').find('.divClass').css({
									"left": '-1px',
									"top": "0px",
									"border-bottom": "1px solid #ccc",
									"border-top": "none"
								});
								$(this).parents('li').find('.pname').css({"left": '-1px', "top": -1 - pHeight + "px"});
							}
							;

							//定位pname位置
							var liWidth = $(this).parents('li').width();
							var index = $(this).parent('li').index();
							var indexkey = Math.ceil((index + 1) / 4);
							if((4 * indexkey - 1 == index + 1 ) || 4 * indexkey == index + 1){
								$(this).parents('li').find('.pname').css({"left": (-2 * liWidth - 1) + 'px'});
							}
							//鼠标移出事件
							$(option.objId).find('li.posLi').mouseleave(function(index){
								if(cHeight - (liTop - cTop + pHeight) - 20 > 0){
									$(this).find('.divClass').css({"border-top": "none"});
								}else{
									$(this).find('.divClass').css({"border-bottom": "none"});
								}
							});
						}
					});
				},
				error: function(){
					layer.msg('Error caused by network causes, please reload', {time: 1500});
				}
			});
			//点击确定按钮
			$(option.objId).find('a').click(function(){
				inpdetermines();	//外面放在input表单里面点击确定按钮的函数
			});

			//搜索内容
			$(option.objId).find('#sub').click(function(){
				var keyword = str_trim($('#myform').find('#keyword').val());
				$('#myform').find('#keyword').val(keyword);
				var arr = [];
				if(keyword != ''){
					$.ajax({
						type: "GET",
						url: "/common/en/searchthree/" + keyword,
						dataType: "json",
						success: function(data){
							if(data.length > 0){
								var arr = [];
								$.each(data, function(k, v){
									arr[k] = [v.cid, v.name, v.pid];
								});
								searchcons(randfrm, arr);
							}else{
								layer.msg('No search to the results, you can shorten the keywords and search again', {
									time: 1500,
									shift: 6
								});
							}
						}, error: function(){
							layer.msg('May be network reason caused by error', {time: 1500});
						}
					});
				}else{
					$(option.objId + ' .cateType .removesearch').remove();
				}
			});
		}

		//搜索的设置高度
		this.searchHeight = function(){
			//设置弹出层的高度
			$(option.objId).find('.cateType .removesearch').find('dd').each(function(index){
				var key = $(this).find('li').length;
				var indexkey = Math.ceil(key / 4);
				var liHeight = $(this).find('li').height();
				$(this).css({"height": (liHeight * indexkey) + 'px'});
				$(this).parent('dl').find('dt').css({
					"height": (liHeight * indexkey) + 'px',
					"background-color": '#f5f5f5'
				});
			});
		}

		//设置高度
		this.setHeight = function(){
			//设置弹出层的高度
			$(option.objId).find('.cateType').find('dd').each(function(index){
				var key = $(this).find('li').length;
				var indexkey = Math.ceil(key / 4);
				var liHeight = $(this).find('li').height();
				$(this).css({"height": (liHeight * indexkey) + 'px'});
				$(this).parent('dl').find('dt').css({
					"height": (liHeight * indexkey) + 'px',
					"background-color": '#f5f5f5'
				});
			});
		}

		//搜索内容
		function searchcons(randfrm, data){
			var str = '';
			str += '<dl class="removesearch">';
			str += '<dt><span>search result</span></dt>';
			str += '<dd><ul>';
			$.each(data, function(key, value){
				str += '<li><a data-id="' + value[0] + '" data-pid="' + value[2] + '">' + value[1] + '</a></li>';
			});
			str += '</ul></dd>';
			str += '</dl>';
			$(option.objId + ' .cateType .removesearch').remove();
			$(option.objId + ' .cateType').prepend(str);
			//设置高度
			othis.searchHeight();

			//搜索点击事件
			$(option.objId + ' .cateType .removesearch').find("li a").click(function(){
				var searchkey = $(this).attr("data-id");
				var pid = $(this).attr("data-pid");
				var searchvalue = $(this).html();
				var checkboxObjChecked = $(option.objId + " input[type='checkbox']:checked");
				//搜索点击事件
				$(option.objId).find('dd li div').each(function(){
					var dthis = $(this);
					if($(this).find('span').attr("kpos") == pid){
						if($(this).parent('li').find('.pname').html() == undefined || $(this).parent('li').find('.pname').html() == 'null'){
							var ostr = '<div class="pname" style="display: none"><ul></ul></div>';
							dthis.find('span').parents('li').append(ostr);//追加到页面
							$.ajax({
								type: "GET",
								url: "/common/en/thirdposition/" + pid,
								dataType: "json",
								success: function(data){
									var str = '';
									//循环一级职位
									$.each(data, function(key, v){
										str += '<li>';
										str += '<input name="jobFunctions[]" id="jobFunctions' + randfrm + v.text + '" data-name="' + v.value + '" type="checkbox" class="checkboxs" value="' + v.text + '" />';
										str += '<label for="jobFunctions' + randfrm + v.text + '">' + v.value + '</label>';
										str += '</li>';
									});
									dthis.find('span').parents('li').find('.pname ul').append(str);//追加到页面

									//判断是不是选择了这个职位
									if(!$(option.objChcekbox + searchkey).is(':checked')){
										if(checkboxObjChecked.size() >= 0 && checkboxObjChecked.size() < option.objInpaLength){
											$(option.objId + ' .first').find('.one').hide();
											$(option.objId + ' .first').find('.two').show();
											poscate = '<div class="ctype" id="' + option.objSelect + searchkey + '"><span>' + searchvalue + '</span><i></i></div>';
											$(option.objCate).append(poscate);

											$(option.objChcekbox + searchkey).parents().parent('.pname').prev('.divClass').find('span').css({"color": "#800080"});
											$(option.objChcekbox + searchkey).attr('checked', 'checked');
											$(option.objChcekbox + searchkey).next().css({"color": "#800080"});
										}else{
											layer.msg('Can only choose' + option.objInpaLength + 'individual');
										}
									}
									//点击i关闭事件
									$(option.objId).find(option.objCate).find("#" + option.objSelect + searchkey).find('i').click(function(){
										objClose(searchkey);
									});

									//点击表单事件
									dthis.parents('li').find('.pname').find("input[type='checkbox']").click(function(){
										clickInput($(this));
									});
								},
								error: function(){
									layer.msg('Network reasons caused by mistake, please reload', {time: 1500});
								}
							});
							//鼠标移出事件
							dthis.parents('li.posLi').mouseleave(function(index){
								$(this).find('.divClass').removeClass('addAttr');
								$(this).find('.pname').hide();
							});
						}else{
							//判断是不是选择了这个职位
							if(!$(option.objChcekbox + searchkey).is(':checked')){
								if(checkboxObjChecked.size() >= 0 && checkboxObjChecked.size() < option.objInpaLength){
									$(option.objId + ' .first').find('.one').hide();
									$(option.objId + ' .first').find('.two').show();
									poscate = '<div class="ctype" id="' + option.objSelect + searchkey + '"><span>' + searchvalue + '</span><i></i></div>';
									$(option.objCate).append(poscate);

									//点击i关闭事件
									$(option.objId).find(option.objCate).find("#" + option.objSelect + searchkey).find('i').click(function(){
										objClose(searchkey);
									});

									$(option.objChcekbox + searchkey).parents().parent('.pname').prev('.divClass').find('span').css({"color": "#800080"});
									$(option.objChcekbox + searchkey).attr('checked', 'checked');
									$(option.objChcekbox + searchkey).next().css({"color": "#800080"});

								}else{
									layer.msg('Can only choose' + option.objInpaLength + 'individual');
								}
							}else{
								layer.msg('You have chosen the position');
							}
						}
						return false;
					}
				});

			});
		}

		//显示input表单私有方法
		function keep_inputCon(objthis, index, randfrm){
			//获取三级职位
			$.ajax({
				type: "GET",
				url: "/common/en/thirdposition/" + objthis.attr('kpos'),
				dataType: "json",
				success: function(data){
					if(objthis.parents('li').find('.pname').html() == null || objthis.parents('li').find('.pname').html() == ''){
						objthis.parent('div').addClass('addAttr').siblings().removeClass('addAttr');
						var ostr = '';
						ostr += '<div class="pname"><ul></ul></div>';
						$(objthis).parents('li').append(ostr);

						var str = '';
						//循环一级职位
						$.each(data, function(key, v){
							str += '<li>';
							str += '<input name="jobFunctions[]" id="jobFunctions' + randfrm + v.text + '" data-name="' + v.value + '" type="checkbox" class="checkboxs" value="' + v.text + '" />';
							str += '<label for="jobFunctions' + randfrm + v.text + '">' + v.value + '</label>';
							str += '</li>';
						});
						$(objthis).parents('li').find('.pname ul').append(str);//追加到页面
						//二级菜单点击input表单事件
						objthis.parents('li').find('.pname').find("input[type='checkbox']").click(function(){
							clickInput($(this));
						});

						//点击加载弹出层定位
						var cTop = $(option.objId).find('.cateType').offset().top;		//当前框到顶部的值
						var cHeight = $(option.objId).find('.cateType').height();		//当前高度
						var liTop = objthis.parents('li').offset().top;
						var pHeight = objthis.parents('li').find('.pname').height();
						var liHeight = objthis.parents('li').height();
						if(cHeight - (liTop - cTop + pHeight) - 20 > 0){
							objthis.parents('li').find('.divClass').css({
								"left": '-1px',
								"top": "-1px",
								"border-top": "1px solid #ccc",
								"border-bottom": "none"
							});
							objthis.parents('li').find('.pname').css({"left": '-1px', "top": liHeight - 2 + "px"});
						}else{
							objthis.parents('li').find('.divClass').css({
								"left": '-1px',
								"top": "0px",
								"border-bottom": "1px solid #ccc",
								"border-top": "none"
							});
							objthis.parents('li').find('.pname').css({"left": '-1px', "top": -1 - pHeight + "px"});
						}
						//定位位置
						var liWidth = objthis.parents('li').width();
						var indexkey = Math.ceil((index + 1) / 4);
						if((4 * indexkey - 1 == index + 1 ) || 4 * indexkey == index + 1){
							objthis.parents('li').find('.pname').css({"left": (-2 * liWidth - 1) + 'px'});
						}
						//鼠标移出事件
						$(option.objId).find('li.posLi').mouseleave(function(index){
							$(this).find('.divClass').removeClass('addAttr');
							$(this).find('.pname').hide();
							if(cHeight - (liTop - cTop + pHeight) - 20 > 0){
								$(this).find('.divClass').css({"border-top": "none"});
							}else{
								$(this).find('.divClass').css({"border-bottom": "none"});
							}
						});
					}
				},
				error: function(){
					layer.msg('Network reasons caused by mistake, please reload', {time: 1500});
				}
			});
		}

		//@parm othis 当前表单
		//input 表单点击事件
		function clickInput(othis){
			var checkboxObjChecked = $(option.objId + " input[type='checkbox']:checked");
			if(checkboxObjChecked.size() > option.objInpaLength){
				$(option.objChcekbox + othis.val()).attr('checked', false);
				layer.msg('Can only choose' + option.objInpaLength + 'individual', {time: 1500});
				return false;
			}
			if(checkboxObjChecked.size() >= 0 && checkboxObjChecked.size() <= option.objInpaLength){
				$(option.objId + ' .first').find('.one').hide();
				$(option.objId + ' .first').find('.two').show();
				if(othis.is(':checked')){
					//点击input选中
					othis.next().css({"color": "#800080"});
					if(option.objLevel == '2'){	//判断是不是二级菜单
						othis.parents().parent('.pname').prev('.divClass').find('span').css({"color": "#800080"});
					}
					var thisval = othis.val();
					pcate = $(option.objChcekbox + thisval).attr('data-name');
					poscate = '<div class="ctype" id="' + option.objSelect + thisval + '"><span>' + pcate + '</span><i></i></div>';
					$(option.objCate).append(poscate);

					//点击i关闭事件
					$(option.objId).find(option.objCate).find("#" + option.objSelect + thisval).find('i').click(function(){
						objClose(thisval);
					});
				}else{
					othis.next().css({"color": "#0066CC"});
					if(!othis.parents().parent('.pname').find('li input').is(':checked') && option.objLevel == '2'){
						othis.parents().parent('.pname').prev('.divClass').find('span').css({"color": "#0066CC"});
					}
					if(!$(option.objId).find('dd').find('li input').is(':checked')){
						$(option.objId + ' .first').find('.one').show();
						$(option.objId + ' .first').find('.two').hide();
					}
					poscate = $('#' + option.objSelect + othis.val());
					poscate.remove();
				}
			}else{
				$(option.objId + ' .first').find('.one').show();
				$(option.objId + ' .first').find('.two').hide();
				$(option.objId + ' .ctype').remove();
			}
		}


		//@parm okey 当前input键值 Val值
		//点击i 关闭事件
		function objClose(okey){
			$(option.objChcekbox + okey).attr('checked', false);
			$('#' + option.objSelect + okey).remove();
			$(option.objChcekbox + okey).next().css({"color": "#0066CC"});
			if(!$(option.objChcekbox + okey).parents().parent('.pname').find('li input').is(':checked') && option.objLevel == '2'){
				$(option.objChcekbox + okey).parents().parent('.pname').prev('.divClass').find('span').css({"color": "#0066CC"});
			}
			if($(option.objId + " input[type='checkbox']:checked").size() <= 0){
				$(option.objId + ' .first').find('.one').show();
				$(option.objId + ' .first').find('.two').hide();
			}
		}

		//**********外面放在input表单里面点击确定按钮的函数***********************************************************************************
		function inpdetermines(){
			var strjoin = '';
			$(option.objPostCate).val();
			var checkboxObj = $(option.objId + " input[type='checkbox']");
			var input_val;
			var jobArray = new Array();
			var joinArray = new Array();
			$.each(checkboxObj, function(key, value){
				if(checkboxObj[key].checked == true){
					input_val = checkboxObj.eq(key).val();
					jobArray.push(input_val);
				}
			});
			/**清空数组里面的值**/
			for(i = 0; i < option.objArr.length; i++){
				$(option.objArr[i]).val("");
			}
			if(jobArray.length > 0){
				for(i = 0; i < jobArray.length; i++){
					$(option.objArr[i]).val(jobArray[i]);
					pcate = $(option.objChcekbox + jobArray[i]).attr('data-name');
					joinArray.push(pcate);
				}
			}else{
				strjoin = '';
			}

			//以+号链接字符串
			strjoin = joinArray.join("+");
			$(option.objPostCate).val(strjoin);

			$(option.keep_sceen).hide();
			$(option.objId).hide();
			option.callback(jobArray, strjoin);
		}


		//显示遮掩层函数
		this.layer = function(){
			screenX = $(window).width();
			screenH = $(window).height();
			documentH = $(document).height();
			iLeft = parseInt((screenX - $(option.objId).width()) / 2);
			iTop = parseInt((screenH - $(option.objId).height()) / 2);
			if(screenX < $(option.objId).width()){
				screenX = $(option.objId).width();
				iLeft = 0;
			}
			$(option.objId).css({'left': iLeft, 'top': iTop}).show();		//对象显示
			$(option.objId).find('.two .close').click(function(){		//点击关闭按钮时，关闭窗口
				$(option.keep_sceen).hide();
				$(option.objId).hide();
			});
			//div遮掩层
			$(option.keep_sceen).css({
				"width": screenX + 'px',
				"height": documentH + 'px',
				'background': '#111111',
				'opacity': 0.5
			}).show();


			//判断IE6
			if(isIE6){
				$(option.keep_sceen).css({
					position: "absolute",
					"width": screenX + 'px',
					"height": documentH + 'px',
					left: 0,
					top: 0,
					'z-index': '1000'
				}).show();

				$(option.objId).css({
					position: "absolute",
					'left': iLeft,
					'top': iTop,
					'z-index': '1001'
				});   //对象显示

			}

			//窗口压缩事件触发
			$(window).resize(function(){
				screenX = $(window).width();
				screenH = $(window).height();
				documentH = $(document).height();
				iLeft = parseInt((screenX - $(option.objId).width()) / 2);
				iTop = parseInt((screenH - $(option.objId).height()) / 2);
				if(screenX < $(option.objId).width()){
					screenX = $(option.objId).width();
					iLeft = 0;
				}
				if(screenH < $(option.objId).height()){
					screenH = documentH;
					iTop = 0;
				}else{
					screenH = documentH;
				}
				$(option.keep_sceen).css({"width": screenX, "height": screenH});
				$(option.objId).css({"left": iLeft, "top": iTop});
			});
		}

		//显示弹出层函数
		this.nextshow = function(randfrm){
			var checkboxObj = $(option.objId + " input[type='checkbox']");
			checkboxObj.attr('checked', false);
			$(option.objId + ' .ctype').remove();
			//设置样式
			$(option.objId).find('label').css({"color": "#0066CC"});
			if(option.objLevel == '2'){
				$(option.objId).find('.divClass').find('span').css({"color": "#0066CC"});
			}

			var newArr = [];
			for(i = 0; i < option.objArr.length; i++){
				if($(option.objArr[i]).val() != '' && $(option.objArr[i]).val() != '0'){
					newArr.push($(option.objArr[i]).val());
				}
			}
			var pidArr = [];
			for(i = 0; i < newArr.length; i++){
				pidArr.push(newArr[i].substring(0, 4) + '00');
			}
			pidArr = array_merge(pidArr);

			var pid = '';
			//判断是不是默认值存在
			if(pidArr.length > 0){
				for(var i = 0; i < pidArr.length; i++){
					pid = pidArr[i];
					//设置样式
					if(option.objLevel == '2'){
						$(option.objId).find('dd li div').each(function(){
							var dthis = $(this);
							if($(this).find('span').attr("kpos") == pid){
								if($(this).parent('li').find('.pname').html() == undefined || $(this).parent('li').find('.pname').html() == 'null'){
									var ostr = '<div class="pname" style="display: none"><ul></ul></div>';
									dthis.find('span').parents('li').append(ostr);//追加到页面
									//使用闭包函数  把i cid作用在这个函数体内
									(function(x, pid){
										$.ajax({
											type: "GET",
											url: "/common/en/thirdposition/" + pid,
											dataType: "json",
											success: function(data){
												var str = '';
												//循环一级职位
												$.each(data, function(key, v){
													str += '<li>';
													str += '<input name="jobFunctions[]" id="jobFunctions' + randfrm + v.text + '" data-name="' + v.value + '" type="checkbox" class="checkboxs" value="' + v.text + '" />';
													str += '<label for="jobFunctions' + randfrm + v.text + '">' + v.value + '</label>';
													str += '</li>';
												});
												dthis.find('span').parents('li').find('.pname ul').append(str);//追加到页面

												for(var j = 0; j < newArr.length; j++){
													if(newArr[j].substring(0, 4) == pid.substring(0, 4)){
														(function(j){
															//设置样式
															dthis.find('span').css({"color": "#800080"});
															$(option.objChcekbox + newArr[j]).attr('checked', 'checked');
															$(option.objChcekbox + newArr[j]).next().css({"color": "#800080"});

															pcate = $(option.objChcekbox + newArr[j]).attr('data-name');
															poscate = '<div class="ctype" id="' + option.objSelect + newArr[j] + '"> <span>' + pcate + '</span><i></i></div>';
															$(option.objCate).append(poscate);
															//点击i关闭事件
															$(option.objId).find(option.objCate).find("#" + option.objSelect + newArr[j]).find('i').click(function(){
																objClose(newArr[j]);
															});
														})(j);
													}
												}
												//点击表单事件
												dthis.parents('li').find('.pname').find("input[type='checkbox']").click(function(){
													clickInput($(this));
												});
											},
											error: function(){
												layer.msg('Network reasons caused by mistake, please reload', {time: 1500});
											}
										});
										//鼠标移出事件
										dthis.parents('li.posLi').mouseleave(function(index){
											$(this).find('.divClass').removeClass('addAttr');
											$(this).find('.pname').hide();
										});
									})(i, pid);
								}else{
									for(var j = 0; j < newArr.length; j++){
										if(newArr[j].substring(0, 4) == pid.substring(0, 4)){
											(function(j){
												//设置样式
												dthis.find('span').css({"color": "#800080"});
												$(option.objChcekbox + newArr[j]).attr('checked', 'checked');
												$(option.objChcekbox + newArr[j]).next().css({"color": "#800080"});

												pcate = $(option.objChcekbox + newArr[j]).attr('data-name');
												poscate = '<div class="ctype" id="' + option.objSelect + newArr[j] + '"> <span>' + pcate + '</span><i></i></div>';
												$(option.objCate).append(poscate);
												//点击i关闭事件
												$(option.objId).find(option.objCate).find("#" + option.objSelect + newArr[j]).find('i').click(function(){
													objClose(newArr[j]);
												});
											})(j);
										}
									}
								}
								return false;
							}
						});
					}
				}
			}

			if(newArr.length > 0){
				$(option.objId + ' .first').find('.one').hide();
				$(option.objId + ' .first').find('.two').show();
			}else{
				$(option.objId + ' .first').find('.one').show();
				$(option.objId + ' .first').find('.two').hide();
			}
		}
		//判断对象是不是存在
		this.keep_sceen = function(){
			if($("#keep_sceen").length <= 0){
				$("body").append('<div class="cover" id="keep_sceen" style="z-index:1002;position:absolute;display:block"></div>');
			}
		}
	}
})(jQuery);

var cateObj = new $.Categories();
//--------------------------------创建岗位input类别对象----------------------------------------------------------------------------
function posCateInput(randfrm, selmod){
	var arrobj = {
		objId: '#jobFun' + randfrm,					        //当前显示内容的ID值
		objCate: '#funCate' + randfrm,					        //当前页面弹出层显示要追加的岗位类别内容
		objTwoCate: '#twofunCate' + randfrm,				    //当前页面要追加的岗位类别内容
		objChcekbox: '#jobFunctions' + randfrm,			    //当前弹出层 复选框checkbox的前缀名id值
		objSearchChcekbox: '#jobFunctionSearch' + randfrm,     //当前弹出层 复选框checkbox的前缀名id值 搜索的复选框
		objSelect: 'funSelect' + randfrm,				        //当前弹出层 追加到弹出要追加的内容里面的ID前缀值
		//objTwoSelect:'twofunSelect'+randfrm,			    //当前页面  追加到当前页面要追加的内容里面的ID前缀值
		objPostCate: '#jobsort',                             //当前页面  追加到当前页面input要追加的内容里面的ID前缀值
		objArr: ["#jobsort1" + randfrm, "#jobsort2" + randfrm, "#jobsort3" + randfrm, "#jobsort4" + randfrm, "#jobsort5" + randfrm], //当前隐藏表单
		keep_sceen: '#keep_sceen',					        //遮掩层
		objLevel: '2',								        //设置当前显示的级别
		objType: '1',								        //设置当前显示的类型
		objMod: selmod,                                      //选择模式 当传入值为1时。出现大类不限
		objInpaLength: '5'								    //设置当前input 表单选项的个数
	};
	cateObj.showextend(randfrm, arrobj);
}
